package com.platform.dao.mybatis.impl;

import com.platform.dao.ResourcesDao;
import com.platform.dao.mybatis.mapper.ResourcesMapper;
import com.platform.domain.model.Resources;
import com.platform.domain.result.ResourceRole;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
* Resources
*
* User: wangyang
* DateTime: 2012-10-08 16:11:49
*
*/
@Service("resourcesDao")
public class ResourcesDaoImpl implements ResourcesDao {



    @Resource
    private ResourcesMapper resourcesMapper;

    /**
     * 查询所有资源与角色的对应关系
     *
     * @return ResourceRole对象
     */
    @Override
    public List<ResourceRole> selectByRole() throws Exception {
        return resourcesMapper.selectByRole();
    }

    /**
    *
    * 根据主键查询Resources对象
    *
    * @param resourceId
    * @return Resources对象
    */
    @Override
    public Resources selectByPrimaryKey(String resourceId) throws Exception {
        return resourcesMapper.selectByPrimaryKey(resourceId);
    }

    /**
    *
    * 根据查询条件查询符合条件的Resources对象
    *
    * @param resources
    * @return 符合条件的Resources对象List
    */
    @Override
    public List<Resources> select(Resources resources) throws Exception {
        return resourcesMapper.select(resources);
    }

    /**
    *
    * 根据主键删除Resources对象
    *
    * @param resourceId
    * @return 影响条件数
    */
    @Override
    public int deleteByPrimaryKey(String resourceId) throws Exception {
        return resourcesMapper.deleteByPrimaryKey(resourceId);
    }

    /**
    *
    * 根据条件删除符合条件的Resources对象
    *
    * @param resources
    * @return 影响条件数
    */
    @Override
    public int delete(Resources resources) throws Exception {
        return resourcesMapper.delete(resources);
    }

    /**
    *
    * 插入Resources对象
    *
    * @param resources
    * @return 影响条件数
    */
    @Override
    public int insert(Resources resources) throws Exception {
        return resourcesMapper.insert(resources);
    }

    /**
    *
    * 更新Resources对象
    *
    * @param resources
    * @return 影响条件数
    */
    @Override
    public int update(Resources resources) throws Exception {
        return resourcesMapper.update(resources);
    }
}
